package com.xiaoxing.gongqiju.mvp.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xiaoxing.gongqiju.R;
import com.xiaoxing.gongqiju.mvp.ui.entity.LiaoCheng_GongQiJu_GuiHuan;

import java.util.List;

//import me.jessyan.armscomponent.commonres.utils.GlideUtil;


public class LiaoCheng_GongQiJu_GuiHuanAdapter extends BaseQuickAdapter<LiaoCheng_GongQiJu_GuiHuan.DataBean, BaseViewHolder> {

    private Context mContext;
    private ILiaoCheng_GongQiJu_GuiHuanAdapter iLiaoCheng_gongQiJu_guiHuanAdapter;

    public LiaoCheng_GongQiJu_GuiHuanAdapter(Context context, @Nullable List<LiaoCheng_GongQiJu_GuiHuan.DataBean> data, ILiaoCheng_GongQiJu_GuiHuanAdapter iLiaoCheng_gongQiJu_guiHuanAdapter) {
        super(R.layout.item_liao_cheng__gong_qi_ju__gui_huan, data);
        this.mContext = context;
        this.iLiaoCheng_gongQiJu_guiHuanAdapter = iLiaoCheng_gongQiJu_guiHuanAdapter;
    }

    @Override
    protected void convert(BaseViewHolder helper, LiaoCheng_GongQiJu_GuiHuan.DataBean item) {
        //GlideUtil.loadImage(mContext,item.getImg(),helper.getView(R.id.img_head));
        helper.setText(R.id.tv_mtid, "mtid：" + item.getMtid());
        helper.setText(R.id.tv_ying_gui_huan_shu_liang, "应归还数量：" + item.getOutNum());
        helper.setText(R.id.tv_dan_wei, "单位：" + item.getUnit());
        helper.setText(R.id.tv_gong_ju_ming_cheng, "工具名称：" + item.getMaterialtoolname());
        helper.setText(R.id.tv_na_huo_ren_xing_ming, "拿货人姓名：" + item.getRecevieusername());
        helper.setText(R.id.tv_na_huo_ren_dian_hua, "拿货人电话：" + item.getReceiveusephone());
        if (item.getMaterialCodeMode().equals("1")) {
            helper.setText(R.id.tv_lei_xing, "类型：大工具");
        } else if (item.getMaterialCodeMode().equals("2")) {
            helper.setText(R.id.tv_lei_xing, "类型：小工具");

        }

        helper.setOnClickListener(R.id.btn_cao_zuo, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                iLiaoCheng_gongQiJu_guiHuanAdapter.caoZuo(item);
            }
        });

    }

    public interface ILiaoCheng_GongQiJu_GuiHuanAdapter {
        void caoZuo(LiaoCheng_GongQiJu_GuiHuan.DataBean item);

    }

}
